# local testing in docker-compose
version: '3.1'

services:

  mongo:
    image: mongo
    container_name: my-mongodb
    ports:
      - 27017:27017
    environment:
      - MONGO_INITDB_DATABASE=my_database
      - MONGO_INITDB_ROOT_USERNAME=admin
      - MONGO_INITDB_ROOT_PASSWORD=password
    volumes:
      - mongo-data:/data/db
    networks:
      - mongo_net

  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8080:8081
    environment:
      - ME_CONFIG_MONGODB_ADMINUSERNAME=admin
      - ME_CONFIG_MONGODB_ADMINPASSWORD=password
      - ME_CONFIG_MONGODB_SERVER=mongo
    networks:
      - mongo_net

  iot:
    image: djsasha777/myiotimage:16
    container_name: iot
    ports:
      - 8088:8088
    environment:
      - MONGO_MONGODB_USERNAME=admin
      - MONGO_MONGODB_PASSWORD=password
      - MONGO_MONGODB_SERVER=mongo
      - MONGO_MONGODB_DATABASE=my_database
    networks:
      - mongo_net

networks:
  mongo_net:
    driver: bridge

volumes:
  mongo-data:
    driver: local
